package net.zjitc.springboot.common;

/**
 * @author 何景航
 * @date 2025/5/14 10:57
 */
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static Result success() {
        Result r = new Result();
        r.setCode(200);
        r.setMsg("操作成功");
        return r;
    }

    public static Result error() {
        Result r = new Result();
        r.setCode(500);
        r.setMsg("操作失败");
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
